// 根路径优化
axios.defaults.baseURL=`http://api-breakingnews-web.itheima.net`
// 请求头优化
axios.interceptors.request.use(config => {
// Do something before request is sent
if(config.url.includes('/my')){
  config.headers.Authorization=localStorage.getItem('big-event-token')
}
return config;
},error => {
// Do something with request error
return Promise.reject(error);
});
axios.interceptors.response.use(response => {
// Do something before response is sent
// console.log(response.data);
if(response.data.status===1&&response.data.message==='身份认证失败！'){
  location='./login.html'
}
return response;
},error => {
// Do something with response error
return Promise.reject(error);
});